package com.logos.multiThread;

import java.util.concurrent.*;

public class ThreadPoolTest {

    public static void main(String[] args) {
        ExecutorService pool1 = Executors.newFixedThreadPool(10);
//        pool1.submit(new MyRunnable());

        ThreadPoolExecutor pool = new ThreadPoolExecutor(
                3, // 核心线程数
                5, // 最大线程数
                10, // 空闲线程存活时间
                TimeUnit.SECONDS, // 时间单位
                new ArrayBlockingQueue<>(5), // 阻塞队列
                Executors.defaultThreadFactory(), // 线程工厂
                new ThreadPoolExecutor.AbortPolicy() // 拒绝策略
        );

        System.out.println(Runtime.getRuntime().availableProcessors());
    }
}
